package com.niiwoo.civet.trade.service.local.loan;

import com.niiwoo.civet.trade.dao.entity.ProjectBackoutBorrowPrize;
import com.niiwoo.civet.trade.dao.mapper.ProjectBackoutBorrowPrizeMapperExt;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 标的红包退回记录本地服务
 */
@Service
public class ProjectBackoutBorrowPrizeService {

    @Autowired
    ProjectBackoutBorrowPrizeMapperExt projectBackoutBorrowPrizeMapperExt;

    @Transactional(isolation = Isolation.READ_COMMITTED)
    public boolean updateStatus(ProjectBackoutBorrowPrize borrowPrize) {
        return projectBackoutBorrowPrizeMapperExt.updateStatus(borrowPrize) > 0;
    }

    public List<ProjectBackoutBorrowPrize> getAllNotBack() {
        return projectBackoutBorrowPrizeMapperExt.selectUnBackList();
    }

    @Transactional
    public void del(Long projectId) {

        projectBackoutBorrowPrizeMapperExt.deleteByPrimaryKey(projectId);

    }
}
